# Maintainer: Anjandev Momi <anjan@momi.ca>
# Contributor: Maarten van Gompel <proycon@anaproy.nl>
pkgname=sxmo-utils
pkgver=1.9.0
pkgrel=0
pkgdesc="Utility scripts, programs, and configs that hold the Sxmo UI environment together"
url="https://git.sr.ht/~mil/sxmo-utils"
arch="all !s390x !riscv64" # limited by modemmanager and networkmanager -> polkit
arch="$arch !ppc64le" # limited by codemadness-frontends
license="AGPL-3.0-only"
makedepends="libx11-dev xproto linux-headers"
depends="
	coreutils
	gawk
	curl
	doas
	gojq
"

options="!check" # has no tests
subpackages="$pkgname-openrc"
source="
	$pkgname-$pkgver.tar.gz::https://git.sr.ht/~mil/sxmo-utils/archive/$pkgver.tar.gz
	rootfs-etc-NetworkManager-conf.d-00-sxmo.conf
	rootfs-etc-polkit-1-rules.d-00-sxmo.rules
	rootfs-etc-polkit-1-rules.d-50-org.freedesktop.NetworkManager.rules
	"

package() {
	mkdir -p "$pkgdir/etc/modules-load.d/"
	printf %b "snd-aloop" > "$pkgdir/etc/modules-load.d/sxmo.conf"
	mkdir -p "$pkgdir/etc/modprobe.d/"
	printf %b "options snd slots=,snd-aloop" > "$pkgdir/etc/modprobe.d/sxmo.conf"

	make  -C "$builddir" DESTDIR=$pkgdir install

	install -Dm644 "$srcdir/rootfs-etc-NetworkManager-conf.d-00-sxmo.conf" \
		"$pkgdir/etc/NetworkManager/conf.d/00-sxmo.conf"

	install -Dm755 "$srcdir/rootfs-etc-polkit-1-rules.d-00-sxmo.rules" \
		"$pkgdir/etc/polkit-1/rules.d/00-sxmo.rules"

	install -Dm755 "$srcdir/rootfs-etc-polkit-1-rules.d-50-org.freedesktop.NetworkManager.rules" \
		"$pkgdir/etc/polkit-1/rules.d/50-org.freedesktop.NetworkManager.rules"
}

sha512sums="
748665867996722560e68933a24fc49068881904e449ac9b39648eae7a106c5d78158adf0bad8fe401f1e760e16248cba338b6280f53514afd7bfa8d4bef20e3  sxmo-utils-1.9.0.tar.gz
67a031f309a3232ac1e8abc3fedeaee912c035f9c81b4f709248895905a27ab5844ec92c65e55b79af3894450ba3883549d4004f11efebb47114d41f730e4a5f  rootfs-etc-NetworkManager-conf.d-00-sxmo.conf
32532ad5071588b80f43d539b3bd140e3f5b4100fca244be2ade5b8c697c76043ce5278ae7bf14762106aed2c9690f34c14e73031e5d86c11cc042c8f7245421  rootfs-etc-polkit-1-rules.d-00-sxmo.rules
7b34e861bc4ec57d970d2a7aacca36e3c3742a63ff995af1336f80b666e4a38c1035b35e129322e0d62dc75011bfaf495eb2bcae5392f2bf39f1d7b1400afcce  rootfs-etc-polkit-1-rules.d-50-org.freedesktop.NetworkManager.rules
"
